package Semantics;

import SyntaxTree.XYZ2parserTreeConstants;

public class ClassSymbol extends VarSymbol {
	private String superClass = "";
	private HashT methodHash = new HashT();
	private HashT varHash = new HashT();
	
	public ClassSymbol(){
		super(XYZ2parserTreeConstants.JJTCLASSDECL);
	}
	
	public void setSuper(String s){
		superClass = s;
	}
	 
	public String getSuper(){
		return superClass;
	}
	
	public int addMethod(MethodSymbol symbol){
		String id = symbol.getId();
		methodHash.insert(id, (MethodSymbol)symbol);
		return 0;
	}
	
	public Object[] getAllMethod(String id){
		return methodHash.lookupall(id);
	}
	
	public int addVarSymbol(VarSymbol symbol){
		String id = symbol.getId();
		VarSymbol s = (VarSymbol)varHash.lookup(id);
		if(s != null)
			return -1;
		varHash.insert(id, (VarSymbol)symbol);
		return 0;
	}
	
	public MethodSymbol getMethodSymbol(String id){
		MethodSymbol ms = (MethodSymbol)methodHash.lookup(id);
		return ms;
	}
	
	public Object[] getAllMethod(){
		return methodHash.getall();
	}
	
	public VarSymbol getVarSymbol(String id){
		VarSymbol s = (VarSymbol)varHash.lookup(id);
		return s;
	}
	
	public HashT getVarHash(){
		return varHash;
	}
	
	public HashT getMethodHash(){
		return methodHash;
	}
}
